package com.an.java.javaall.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author antch
 */
public class LogSendSms implements InvocationHandler {

    private SendSmsService smsService;

    public LogSendSms(SendSmsService smsService) {
        this.smsService = smsService;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("LogSendSms:"+ proxy.getClass().getName());
        System.out.println("LogSendSms:"+ method.getName());
        Object obj = method.invoke(smsService, args);
        return obj;
    }
}
